<template>
  <div>
    <el-card v-for="(item,id) in comment" :key="id" v-if="item.user">
        <el-avatar :size="50" :src="item.user.avatarUrl"></el-avatar>
      <div class="userinfo">
        <h3>{{item.user.nickname}}</h3>
        <span>{{$global.date(item.time)}}</span>
        <hr>
        <p>{{ item.content }}</p>
          <el-button @click="approve(item)"><i class="iconfont icon-dianzan"></i>{{item.likedCount}}</el-button>
      </div>

    </el-card>
  </div>
</template>

<script>
export default {
  name: "MusicComCard",
  props:{comment:{required:true}},
  methods:{
    approve(item){
      this.$store.dispatch('music/MusAddComment',item)

    }
  }
}
</script>

<style scoped>
.el-card{
  margin-top: 20px;
}
.el-avatar{
  position: absolute;
}
hr{
  width: 100%;
  color: #cccccc;
}
.userinfo{
  width: 90%;
  display: inline-block;
  margin: 0 70px;
}
.userinfo span{
  color: #cccccc;
}
.el-button{
  margin-top: 10px;
}
.el-button:focus, .el-button:hover {
  color: black;
  border-color: #c6e2ff;
  background-color: #4d97e3;}
</style>
